﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Windows.Data;
using System.Windows;

namespace sys_Print.Converter
{
    public class DataGridAutoAdjustConverter : IMultiValueConverter
    {
        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
        {
            if (values.Length != 2 || !(values[0] is int) || !(values[1] is double))
            {
                return Binding.DoNothing;
            }

            int rowCount = (int)values[0];
            double totalHeight = (double)values[1];

            // 根据行数和总高度计算行高，这里可以根据需要自定义计算逻辑
            double rowHeight = totalHeight / rowCount;

            return rowHeight;
        }

        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
        {
            throw new NotSupportedException();
        }
    }
}
